24. Exercise: Implement Query

Code Query

Complete the query() method.

Exercise Code

Exercise: T09.05-Exercise-QueryAllTasks

Provider code

In the query method, do the following:

SOLUTION:
  • Get readable access to the underlying task database
  • Write match code and a switch-case to recognize the task directory and default case
  • Query for the tasks directory
  • Set a notification URI on the Cursor

UI code

In the loadingInBackground method

SOLUTION:
  • Use a ContentResolver to query for all of the task data, and sort that data by priority.